﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test10
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList arr = new ArrayList() { "孙武", "abc", "孙悟空", 123, 2333 };
            Console.WriteLine("请输入你要查找的元素：");
            string a = Console.ReadLine();
            int bbc = arr.IndexOf(a);
            if (bbc !=-1)
            {
                Console.WriteLine("集合中有:{0}",a );
            }else
            {
                Console.WriteLine("集合中没有:{0}",a );
            }
            Console.WriteLine();


            ArrayList list = new ArrayList() { "嘻嘻", "哈哈", "嘿嘿", 123, 233 };
            ArrayList list1 = new ArrayList();
            for (int i=0; i<list .Count;i=i +2)
            {
                list1.Add(list[i]);
            }
            foreach (var v in list1 )
            {
                Console.WriteLine(v );
            }
            Console.WriteLine();


            ArrayList list2 = new ArrayList() { "呵呵","嗯嗯","。。。"};
            list.InsertRange(1, list2);
            foreach (var r in list)
            {
                Console.WriteLine(r );
            }
            Console.WriteLine();


            ArrayList list3 = new ArrayList() {"abc","ccc","bbb"};
            list3.Sort();
            foreach (var l in list3 )
            {
                Console.WriteLine(l );
            }
            Console.WriteLine();


            Mycompare my = new Mycompare();
            arr.Sort(my);
            foreach (var s in arr )
            {
                Console.WriteLine(s );
            }

        }
    }
}
